package com.nyist.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 1.测试控制台
 *
 * @author yangxiaogen
 * @date 2023/3/2 17:14
 */
@Slf4j
@RefreshScope // 这里必须的, 在nacos中的配置中心中修改了配置, 在使用类中得到展示
@RestController
public class TestController {
    @Value("${server.port}")
    private String port;
    @Value("${testNacos.defaultValue}")
    private String value;

    @GetMapping("/portTest")
    public String portTest() {
        log.info("=====>>>portTest,,post:{}", port);
        return "test:port = " + port;
    }

    @GetMapping("/valueTest")
    public String valueTest() {
        log.info("=====>>>valueTest,,value:{}", value);
        return "test:value = " + value;
    }

    @GetMapping("/test")
    public String test() {
        log.info("=====>>>test");
        return "test";
    }
}
